<template>
  <div>{{ data.name }}</div>
  <el-input type="text" v-model="data.name"></el-input>
  <el-button type="success" @click="changeName">改变值</el-button>
</template>

<script setup>
import { reactive } from "vue";
import { dateFormat, setName } from "./getNowDate";
// 直接设置一个响应式的对象，后续改变里面的值时不用担心数据不是响应式的
const data = reactive({
  name: "李四",
});
function changeName() {
  data.name = dateFormat();
  setName(data);
}
</script>

